// 防抖
const debounce = function(timeout = 100, fn) {
	let _time = null
	return function() {
		let _arg = arguments
		clearTimeout(_time)
		_time = setTimeout(() => {
			fn.apply(this, _arg)
		}, timeout)
	}
}
// 节流
const throttling = function(timeout = 100, fn) {
	let _playing = null
	return function() {
		let _arg = arguments
		if (_playing) {
			return
		}
		_playing = true
		setTimeout(() => {
			fn.apply(this, _arg)
			_playing = false
		}, timeout)
	}
}
export {
	debounce,
	throttling
}